package com.navinfo.tripanalysis.offline.service;

import com.navinfo.tripanalysis.common.arithmetic.common.OuterStatisticData;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.types.StructType;

import java.io.Serializable;
import java.util.List;

/**
 * 行程统计的扩展信息服务
 * @author web
 */
public interface TripStatisticExtendService extends Serializable{
     /**
      * 创建Hive表的schema
      */
     StructType createSchema();

     /**
      * 通过OuterStatisticData对象创建hive的Row对象
      * @param outerStatisticData 行程统计信息
      * @param schema 对应的schema
      * @return row
      */
     Row toRow(OuterStatisticData outerStatisticData, StructType schema);

     /**
      * 保存行程的扩展信息
      */
     void save(SparkSession spark, JavaSparkContext jsc, JavaPairRDD<Long, List<OuterStatisticData>> pairRDD, long d);
}
